package com.ABdolphin.forum.dao;

import com.ABdolphin.forum.model.Article;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface ArticleMapper {
    int insert(Article record);

    int insertSelective(Article record);

    Article selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(Article record);

    int updateByPrimaryKeyWithBLOBs(Article record);

    int updateByPrimaryKey(Article record);

    List<Article> selectAll();

    /**
     * 根据版块id得到对应的文章列表
     * @param boardId 版块id
     * @return
     */
    List<Article> selectByBoardId(@Param("boardId") Long boardId);

    /**
     * 根据版块id得到对应的文章列表
     * @param userId 版块id
     * @return
     */
    List<Article> selectByUserId(@Param("userId") Long userId);

    /**
     * 根据文章id得到对应的文章
     * @param articleId 文章id
     * @return
     */
    Article selectDetailById(@Param("articleId") Long articleId);
}